package com.project.internship.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.internship.entity.StudentEvaluate;
import com.project.internship.mapper.StudentEvaluateMapper;
import com.project.internship.service.StudentEvaluateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.internship.utils.UserUtils;
import com.project.internship.vo.StudentEvaluateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2020-04-13
 */
@Service
public class StudentEvaluateServiceImpl extends ServiceImpl<StudentEvaluateMapper, StudentEvaluate> implements StudentEvaluateService {

    @Autowired
    StudentEvaluateMapper seMapper;

    @Override
    public IPage<StudentEvaluateVO> getStudentEva(Page<StudentEvaluateVO> page, String keyword) {
        return seMapper.getStudentEva(page, UserUtils.getCurrentUser().getTeacherId(),keyword);
    }

    @Override
    public Integer addStudentEva(StudentEvaluate studentEva) {
        return seMapper.insert(studentEva);
    }

    @Override
    public Integer updateStudentEva(StudentEvaluate studentEva) {
        return seMapper.updateById(studentEva);
    }
}
